package cn.itheima.action;

import cn.itheima.action.common.BaseAction;
import cn.itheima.domain.TakeTime;
import cn.itheima.service.TakeTimeService;
import com.opensymphony.xwork2.ActionContext;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * Created by millions on 2017/7/4.
 */
@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class TakeTimeAction extends BaseAction<TakeTime> {

    @Autowired
    private TakeTimeService takeTimeService;

    @Action(value = "taketime_findAll",results = {@Result(type = "json")})
    public String findAll(){

        List<TakeTime> takeTimeList = takeTimeService.findAllTakeTime();

        ActionContext.getContext().getValueStack().push(takeTimeList);

        return SUCCESS;
    }


}
